/* Copyright (C) 2011 Urals State University,
 * Department of Mathematics and Mechanics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ru.edu.usu.cs.bubbles.utils;

import ru.edu.usu.cs.bubbles.R;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.util.Log;

/**
 * Набор картинок, которые используются в приложении
 * 
 * Чтобы пользоваться - надо создать экземпляр и загрузить картинки. После этого
 * можно пользоваться по всему проекту статичным образом
 * 
 */
public class Graphics {
	private Context context;
	public static Bitmap BackgroundImage;
	public static Drawable BubbleImage;
	public static Drawable WallImage;
	/**
	 * Набор iceWall с различной прозрачностью
	 */
	public static Drawable IceWallImage;
	
	public static Drawable WhirlpoolImage;
	
	private static String TAG = "Graphics";
	

	/**
	 * Загрузка картинок: BackGroundImage, BubbleImage, WallImage, IceWallImage
	 */
	public Graphics(Context context) {
		this.context = context;
	}

	public void loadImage() {
		Log.d(TAG, "loading image");
		Resources res = context.getResources();
		BubbleImage = res.getDrawable(R.drawable.bubble);
		WallImage = res.getDrawable(R.drawable.wallc);
		IceWallImage = res.getDrawable(R.drawable.icewall);
		WhirlpoolImage = res.getDrawable(R.drawable.whirlpool);
		
		BackgroundImage = BitmapFactory.decodeResource(res,
				R.drawable.background);
	}

	public static void resizeBackground(int width, int height) {
		BackgroundImage = Bitmap.createScaledBitmap(BackgroundImage, width,
				height, true);

	}

}
